From: Jasper St. Pierre Date: Wed, 2 May 2012 19:40:31 +0000 (-0400) Subject: placeDisplay: Create our own PlacesManager X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~1013^2^2~6609 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=f2d883dab242ee0d4a4651b94e0261aebdde64a2;p=gnome-shell.git placeDisplay: Create our own PlacesManager Since we don't have a section showing off the available places somewhere, we don't need a global PlacesManager. https://bugzilla.gnome.org/show_bug.cgi?id=675328 --- diff --git a/js/ui/main.js b/js/ui/main.js index 25ad8d8b3..f1795946f 100644 --- a/js/ui/main.js +++ b/js/ui/main.js @@ -46,7 +46,6 @@ let automountManager = null; let autorunManager = null; let panel = null; let hotCorners = []; -let placesManager = null; let overview = null; let runDialog = null; let lookingGlass = null; @@ -80,7 +79,6 @@ function _createUserSession() { // not loading any events until the user presses the clock global.launch_calendar_server(); - placesManager = new PlaceDisplay.PlacesManager(); telepathyClient = new TelepathyClient.Client(); automountManager = new AutomountManager.AutomountManager(); autorunManager = new AutorunManager.AutorunManager(); diff --git a/js/ui/placeDisplay.js b/js/ui/placeDisplay.js index c3117df49..ac8e4dbcb 100644 --- a/js/ui/placeDisplay.js +++ b/js/ui/placeDisplay.js @@ -365,12 +365,13 @@ const PlaceSearchProvider = new Lang.Class({ _init: function() { this.parent(_("PLACES & DEVICES")); + this.placesManager = new PlacesManager(); }, getResultMetas: function(resultIds) { let metas = []; for (let i = 0; i < resultIds.length; i++) { - let placeInfo = Main.placesManager.lookupPlaceById(resultIds[i]); + let placeInfo = this.placesManager.lookupPlaceById(resultIds[i]); if (!placeInfo) metas.push(null); else @@ -385,13 +386,13 @@ const PlaceSearchProvider = new Lang.Class({ }, activateResult: function(id, params) { - let placeInfo = Main.placesManager.lookupPlaceById(id); + let placeInfo = this.placesManager.lookupPlaceById(id); placeInfo.launch(params); }, _compareResultMeta: function (idA, idB) { - let infoA = Main.placesManager.lookupPlaceById(idA); - let infoB = Main.placesManager.lookupPlaceById(idB); + let infoA = this.placesManager.lookupPlaceById(idA); + let infoB = this.placesManager.lookupPlaceById(idB); return infoA.name.localeCompare(infoB.name); }, @@ -409,19 +410,21 @@ const PlaceSearchProvider = new Lang.Class({ else if (mtype == Search.MatchType.SUBSTRING) substringResults.push(place.id); } - prefixResults.sort(this._compareResultMeta); - substringResults.sort(this._compareResultMeta); + prefixResults.sort(Lang.bind(this, this._compareResultMeta)); + substringResults.sort(Lang.bind(this, this._compareResultMeta)); return prefixResults.concat(substringResults); }, getInitialResultSet: function(terms) { - let places = Main.placesManager.getAllPlaces(); + let places = this.placesManager.getAllPlaces(); return this._searchPlaces(places, terms); }, getSubsearchResultSet: function(previousResults, terms) { - let places = previousResults.map(function (id) { return Main.placesManager.lookupPlaceById(id); }); + let places = previousResults.map(Lang.bind(this, function(id) { + return this.placesManager.lookupPlaceById(id); + })); return this._searchPlaces(places, terms); } });